<template>
     <div>
         <ul >
        <li v-for="(val,index) in arr" :key="index" :myid='index'>
       <span> {{val}}</span>   
        <span v-html="str" @click="del(index)"></span> 
        </li>
         </ul>
         <button @click="btn">点击生成</button>
     </div>
</template>

<script>
export default {
    data () {
        return {
             arr:[1,3,5],
             str:'<button @click="btn">删除</button>',
        }
    },
    methods: {
        btn(){
           this.arr.push(Math.floor(Math.random()*20))
           console.log(this.arr);
        },
        del(index){
            this.arr.splice(index,1)
        }
    }
}
</script>

<style>

</style>